package com.bobi.tfca.network.api

import com.bobi.tfca.network.response.BaseResponse
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.Path
import retrofit2.http.Query

interface ResourceAPI {

    /**
     * 上传图片
     *
     * @param requestBody
     * @return
     */
    @Multipart
    @POST("/resource/uploadImage")
    fun uploadImage(@Part file: MultipartBody.Part): Call<BaseResponse<String>>

    /**
     * 获得会员权益
     */
    @Headers("Accept: application/json")
    @GET("/resource/getMemberRights")
    fun getMemberRights(): Call<BaseResponse<String>>

    /**
     * 获得协会章程
     */
    @Headers("Accept: application/json")
    @GET("/resource/getAssRules")
    fun getAssRules(): Call<BaseResponse<String>>

    /**
     * 保存会员权益
     */
    @Headers("Content-Type: text/plain", "Accept: application/json")
    @POST("/resource/saveRightsChange")
    fun saveRightsChange(@Body requestBody: RequestBody): Call<BaseResponse<String>>

    /**
     * 保存协会章程
     */
    @Headers("Content-Type: text/plain", "Accept: application/json")
    @POST("/resource/saveAssRulesChange")
    fun saveAssRulesChange(@Body requestBody: RequestBody): Call<BaseResponse<String>>

    /**
     * 上传组织架构图片
     *
     * @param requestBody
     * @return
     */
    @Multipart
    @POST("/resource/saveOrgStructurePicture")
    fun saveOrgStructurePicture(@Part file: MultipartBody.Part): Call<BaseResponse<String>>

    /**
     * 发送邮箱验证码给在会人员
     */
    @Headers("Accept: application/json")
    @POST("/resource/sendEmailCode2Exist/{account}")
    fun sendEmailCode2Exist(@Path("account") account: String): Call<BaseResponse<String>>

    /**
     * 发送邮箱验证码用于注册
     */
    @Headers("Accept: application/json")
    @POST("/resource/sendEmailCode4Register/{account}")
    fun sendEmailCode4Register(@Path("account") account: String, @Query("email") email: String): Call<BaseResponse<String>>

    /**
     * 得到组织架构的图片
     */
    @Headers("Accept: application/json")
    @GET("/resource/getOrgStructurePicture")
    fun getOrgStructurePicture(): Call<BaseResponse<String>>
}